package wang.suanfang;

public class xuanze {
    public static void main(String[] args) {
        int[] arr = {5, 4, 2, 1, 3};


        for (int i = 0; i < arr.length - 1; i++) {

            for (int j = i + 1; j < arr.length; j++) {
                int temp = arr[i];
                if (arr[i] > arr[j]) {
                    arr[i] = arr[j];
                    arr[j] = temp;
                }

            }

        }

        prrinarr(arr);
    }

    private static void prrinarr(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
